package cn.tedu.zhwy.user.controller;

import cn.tedu.zhwy.base.response.JsonResult;
import cn.tedu.zhwy.user.pojo.dto.UserLoginParam;
import cn.tedu.zhwy.user.pojo.vo.UserVO;
import cn.tedu.zhwy.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/v1/user")
public class UserController {
    @Autowired
    UserService userService;
    @PostMapping("login")
    public JsonResult login(UserLoginParam userLoginParam){
        UserVO userVO = userService.login(userLoginParam);
        return JsonResult.ok(userVO);
    }
    @GetMapping("select")
    public JsonResult select(UserLoginParam userLoginParam){
        List<UserVO> userVOList = userService.select(userLoginParam);
        return JsonResult.ok(userVOList);
    }
}

